
--[[
贡献者:夕颜
时间:5.29
]]

--本加密算法来源于鹿十七

function encodeBase64(code)
	function X(T)return(T:gsub('..',function(x)return string.char((tonumber(x,16))%256)end))end 
	local by=X('0102030405060708091011121314151617181920808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA1A2A3A4A5A6A7A8A9AAABAC')
	function base64_enc(data)
		return ((data:gsub('.', function(x) 
			local r,by='',x:byte()
			for i=8,1,-1 do r=r..(by%2^i-by%2^(i-1)>0 and '1' or '0') end
			return r;
		end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
			if (#x < 6) then return '' end
			local c=0
			for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
			return by:sub(c+1,c+1)
		end)..({ '', '==', '=' })[#data%3+1])
	end
	jie=[=[

	function X(T)return(T:gsub('..',function(x)return string.char((tonumber(x,16))%256)end))end 
	local by=X('0102030405060708091011121314151617181920808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA1A2A3A4A5A6A7A8A9AAABAC')

	function dec(data)
		local data = string.gsub(data, '[^'..by..'=]', '')
		return (data:gsub('.', function(x)
			if (x == '=') then return '' end
			local r,f='',(by:find(x)-1)
			for i=6,1,-1 do r=r..(f%2^i-f%2^(i-1)>0 and '1' or '0') end
			return r;
		end):gsub('%d%d%d?%d?%d?%d?%d?%d?', function(x)
			if (#x ~= 8) then return '' end
			local c=0
			for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
				return string.char(c)
		end))
	end
	]=]
	 code = code:gsub("%[=%[(.-)%]=%]",function(h)
		 return "dec([=["..base64_enc(h).."]=])"
	end)
	 code=code:gsub("\"(.-)\"",function(h)
		 return "dec([=["..base64_enc(h).."]=])"
	end)
	 code,error=code:gsub("'(.-)'",function(h)
		 return "dec([=["..base64_enc(h).."]=])"
	end)
	return jie.."\n\n"..code
end